package whisper.service.monitor.ascept;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import whisper.common.exception.format.PatternException;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by JT on 2017/9/28.
 */
@RestControllerAdvice
public class ControllerExceptionAscept {

    @ExceptionHandler(value = PatternException.class)
    @ResponseBody
    public Map patternExceptionHadnler(PatternException patternException) {
        Map body = new HashMap();
        body.put("code", patternException.getCode());
        body.put("message", patternException.getMessage());
        return body;
    }
}
